#include "TestData.h"
#include <string.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int TestData::MakeData( int iCount )
{
    if (m_pData)
    {
        delete m_pData;
    }
    m_iLen = 0;

    m_pData = new int[iCount];
    if (NULL == m_pData)
    {
        return -1;
    }
    m_iLen = iCount;

    for (int i = 0; i < m_iLen; ++i)
    {
        m_pData[i] = i;
    }

    std::random_shuffle(m_pData, m_pData + m_iLen);

    return 0;
}

int TestData::GetKey()
{
	return m_pData[rand() % m_iLen];
}

